package com.codingbee.controller;

import com.codingbee.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @Description 模拟订单的处理器
 * @Author zouxiang
 * @Date 2020/4/3/22:55
 */
@RestController
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     * 下单
     *
     * @return
     */
    @PostMapping("/placeOrder")
    public String placeOrder() {
        return orderService.placeOrder();
    }
    /**
     * 支付订单
     *
     * @return
     */
    @PostMapping("/payOrder")
    public String payOrder(@RequestBody Map<String,String> map) {
        return orderService.payOrder(map.get("orderNo"));
    }
}
